import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VipTypeVO, VipTypeForm, VipTypeQuery } from '@/api/system/vipType/types';

/**
 * 查询会员类型列表
 * @param query
 * @returns {*}
 */

export const listVipType = (query?: VipTypeQuery): AxiosPromise<VipTypeVO[]> => {
  return request({
    url: '/system/vipType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员类型详细
 * @param id
 */
export const getVipType = (id: string | number): AxiosPromise<VipTypeVO> => {
  return request({
    url: '/system/vipType/' + id,
    method: 'get'
  });
};

/**
 * 新增会员类型
 * @param data
 */
export const addVipType = (data: VipTypeForm) => {
  return request({
    url: '/system/vipType',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员类型
 * @param data
 */
export const updateVipType = (data: VipTypeForm) => {
  return request({
    url: '/system/vipType',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员类型
 * @param id
 */
export const delVipType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/vipType/' + id,
    method: 'delete'
  });
};
